var http = require('http');

var fs = require('fs');

var server = http.createServer(function(req,res){
	console.log(req.url)
	if (req.url != "/favicon.ico") {
		var out = fs.createWriteStream('./request.log');
		console.log("xxxxxxxx")
		out.write("method: " + req.method + '\r\n');
		out.write("url: " + req.url + '\r\n');
		out.write("headers: " + JSON.stringify(req.headers) + '\r\n');
		out.end("httpVersion: " + req.httpVersion + '\r\n');
	};
	res.end();
	// out.end("trailers: " + JSON.stringify(req.trailers));
});

server.listen(1337, "localhost");

server.on('listening', function(){
	console.log("服务器开始监听");
});
